<!DOCTYPE html>
<html class="iframe-h" xmlns:th="http://www.thymeleaf.org">
	<head>
		<meta charset="UTF-8">
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>网站后台管理模版</title>
		<link rel="stylesheet" type="text/css" th:href="@{/layui/css/layui.css}"/>
		<link rel="stylesheet" type="text/css" th:href="@{/css/admin.css}"/>
		<link rel="stylesheet" type="text/css" th:href="@{/lib/bootstraps/css/bootstrap.css}"/>

	</head>

	<body>

		<div>
			<div id="treeview12" class=""></div>
		</div>


		<script th:src="@{/js/jquery-3.2.1.min.js}" type="text/javascript" charset="utf-8"></script>
		<script th:src="@{/layui/layui.js}" type="text/javascript" charset="utf-8"></script>
		<script th:src="@{/js/common.js}" type="text/javascript" charset="utf-8"></script>
		<script th:src="@{/lib/bootstraps/js/treeview/bootstrap-treeview.js}" type="text/javascript" charset="utf-8"></script>



		<script>

			$(function () {
				$.ajax({
					url: '/dept/deptTree',
					type: 'get',
					dataType: 'json',
					success: function (data) {
						var $tree = $('#treeview12').treeview({
							data: data,
							levels: 1,
							color: "#428bca",
							expandIcon: 'glyphicon glyphicon-chevron-right',
							collapseIcon: 'glyphicon glyphicon-chevron-down',
							nodeIcon: 'glyphicon glyphicon-bookmark',
							onNodeSelected: function(event, node) {
								var index = parent.layer.getFrameIndex(window.name);
								parent.$('#deptName').val(node.text);
								parent.$('#deptId').val(node.id);
								//调用change 事件
								parent.$("#deptId").change();
								parent.layer.close(index);
							},
						});
					}
				})
			});


		</script>
	</body>

</html>